package com.hnx.admin.aurora.security.hanler;

import com.hnx.admin.aurora.utils.MessageUtil;
import com.hnx.admin.aurora.utils.ServletUtil;
import com.hnx.admin.aurora.web.json.ResultJson;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.stereotype.Component;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/*
创建人： 倔强的头发
创建时间：2025/6/14
功能描述:

*/
@Component
public class LogoutSuccessHandlerImpl implements LogoutSuccessHandler {
    private static final String LOGOUT_SUCCESS = "user.logout.success";
    @Override
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
        ServletUtil.write(response, com.alibaba.fastjson2.JSON.toJSONString(ResultJson.success(MessageUtil.message(LOGOUT_SUCCESS))));
    }
}
